
ALTER proc [dbo].[CPP_User_DayScore]
  @dwUserID INT,
  @dwKindID INT
AS
BEGIN

  -- 获取用户今日总输赢
  DECLARE @dwGameID INT = 0
  SELECT @dwGameID = GameID FROM AccountsInfo WHERE UserID = @dwUserID
  IF @@ROWCOUNT=0 BEGIN
     RETURN 3
  END

  DECLARE @StartTime DATETIME
  DECLARE @EndTime DATETIME
  DECLARE @ShareCount INT
  DECLARE @DaySocre INT

  SET @StartTime = CAST((SELECT REPLACE(CONVERT(VARCHAR(12) , GETDATE(), 111 ),'/','-')) AS DATETIME)
  SET @EndTime = CAST((SELECT REPLACE(CONVERT(VARCHAR(12) , GETDATE(), 111 ),'/','-')+ ' 23:59:59') AS DATETIME)
  SET @ShareCount = ISNULL((SELECT SUM([lSocre]) FROM [RYRecordDB].[dbo].[PrivateGameRecordUserRecordID]
  WHERE UserID=@dwUserID AND dwKindID = @dwKindID AND InsertTime> @StartTime AND InsertTime < @EndTime),0)

  SELECT @ShareCount AS DayScore

  RETURN 0

END
